/**
 * @FileName: RuntimeCheckActivity.java
 * @Package:com.bdtop.dbl.ui.activities.main
 * @Description: TODO
 * @author: MingjunLi
 * @date:2014-9-16
 * @version V1.0
 */

package com.bdtop.dbl.ui.activities.main;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;

import com.bdtop.dbl.BaseActivity;
import com.bdtop.dbl.R;
import com.bdtop.dbl.ui.activities.acccount.RegisterActivity;
import com.bdtop.dbl.ui.view.CountDownButton;
import com.bdtop.dbl.utils.Preferences;

/**
 * @ClassName: RuntimeCheckActivity
 * @Description: TODO
 * @author: MingjunLi
 * @date:2014-9-16
 */
public class RuntimeCheckActivity extends BaseActivity {

    private CountDownButton mCountDownButton;

    public static final void launch(Context context) {
        Intent intent = new Intent(context, RuntimeCheckActivity.class);
        context.startActivity(intent);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_runtime_check);
        initViews();
        
        Preferences.setFirstRunning(this, false);
    }

    private void initViews() {
        mCountDownButton = (CountDownButton) findViewById(R.id.count_down_btn);
        mCountDownButton.setOnClickListener(mOnClickListener);
    }

    @Override
    protected void onResume() {
        super.onResume();
        mCountDownButton.start(3 * 1000, 1000);
    }

    private OnClickListener mOnClickListener = new OnClickListener() {

        @Override
        public void onClick(View v) {
            switch (v.getId()) {
                case R.id.count_down_btn:
                    RegisterActivity.launch(RuntimeCheckActivity.this);
                    RuntimeCheckActivity.this.finish();
                    break;

                default:
                    break;
            }
        }
    };
}
